package cn.bdqn.pro.controller;

import cn.bdqn.model.PageBean;
import cn.bdqn.pro.model.Route;
import cn.bdqn.pro.service.RouteService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @author gurilla
 * @create 2019-09-10 21:25
 */
@Controller
@RequestMapping("/pro/route")
public class RouteController {
    //调用
    @Resource
    private RouteService routeService;

    @RequiresPermissions("pro:route:page")
    @GetMapping
    public String topage(){
        return "/pro/route";
    }

    @RequiresPermissions("pro:route:list")
    @PostMapping("list")
    @ResponseBody
    public Object list(PageBean pageBean, String pname, String rname, Boolean isover){
        return routeService.list(pageBean, pname, rname, isover);
    }

    @RequiresPermissions("pro:route:save")
    @PostMapping("save")
    @ResponseBody
    public Object save(Route route){
        return routeService.save(route);
    }

    @GetMapping("getproject")
    @ResponseBody
    public Object getProject(){
        return routeService.getProject().getData();
    }

}
